//////////////////////////////////////
// Fast Container Library           //
// MIT License - Copyright (c) 2012 //
//////////////////////////////////////

#pragma once

#include <wchar.h>

#include "string.h"
#include "static_wstring.h"

FC_NAMESPACE_BEGIN


template <>
struct char_traits<wchar_t>
{
	typedef wchar_t		char_type;
	typedef	int			int_type;
	typedef int			off_type;
	typedef size_t		pos_type;
	//typedef mbstate_t	state_type;

	static bool eq( char_type c1, char_type c2 ) { return c1 == c2; }
	static bool lt( char_type c1, char_type c2 ) { return c1 < c2; }

	static void assign( char_type& c, const char_type& value ) { c = value; }
	static char_type* assign( char_type* s, size_t n, char_type value )
	{
		return (char_type*)::wmemset(s, (int)value, n);
	}

	static int compare( const char_type* s1, const char_type* s2, size_t n )
	{
		return ::wmemcmp(s1, s2, n);
	}

	static size_t length( const char_type* s )
	{
		return ::wcslen(s);
	}

	static const char_type* find( const char_type* s, size_t n, const char_type& c )
	{
		return (char_type*)::wmemchr(s, int(c), n);
	}

	static char_type* move( char_type* dest, const char_type* src, size_t n )
	{
		return (char_type*)::wmemmove(dest, src, n);
	}

	static char_type* copy( char_type* dest, const char_type* src, size_t n )
	{
		return (char_type*)::wmemcpy(dest, src, n);
	}
};



// wstring type
typedef basic_string<wchar_t> wstring;

// wstring_ref type
typedef basic_string_ref<wchar_t> wstring_ref;




FC_NAMESPACE_END
